]> dgit.raspbian.org Git - gnome-shell.git/commit
gdm/authPrompt: Preserve the text when switching entry visibility
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 25 Aug 2025 12:35:57 +0000 (14:35 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 30 Aug 2025 01:36:14 +0000 (01:36 +0000)
commit8237970566c6368a54e97db61c28f08cf65a1f90
tree90f02404d42f4e375afc6fb520121db3396754c4
parente3f8f8d727c10c669b32335754a43b45219ec6c7
gdm/authPrompt: Preserve the text when switching entry visibility

The text visibility of an auth prompt entry may change dynamically at
runtime, in particular when unlocking the screen with the blank screen
or with the screen shield visible this is happening:
 - The user starts typing the PAM credential (may be secret or not)
 - Under the hood the PAM conversation starts and actually asks user
   for input
 - The entry text is not cleared because we use what the user has typed
   so far as the preemptive secret.
 - The entry is adjusted to follow the requested PAM text visibility
   settings.
   -> This may lead to switching the actual text entry widget in use

Now, if the first entry that PAM requires is "ECHO ON", like it may
happen in the case in which a visible value is requested, we end up
"clearing" what the user as typed instead of preserving the value as
pre-filled value.

Causing the user typing something wrong instead.

To prevent this we need to restore both the text, the cursor position
and the selection bounds (in case the use pressed some key [binding])
leading to a position or selection change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3850>
js/gdm/authPrompt.js